package com.sunny.t3;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        String ip = scanner.next();

        System.out.println(solve(ip));

    }

    public static int solve(String ip){
        int len = ip.length();
        if(4 == len){
            return 1;
        }else if(5 == len){
            int res = 0;
            for(int i=0;i<len-1;i++){
                if(ip.charAt(i) != '0')
                    res++;
            }
            return res;
        }else if(6 == len){
            int res = 6;
            for(int i=0;i<len-2;i++){
                if(ip.charAt(i) == '1' || (ip.charAt(i) == '2' && ip.charAt(i+1) < '5')
                        || (ip.charAt(i) == '2' && ip.charAt(i+1) == '5' && ip.charAt(i+2)<='5'))
                    res++;
            }
            return res;
        }else if(7 == len){
            int res = 4;

        }
        return 0;
    }

}
